function NDiagramHScrollbar(e,f,i,h,d,c,l,b,j,k,a){this.Create(e,f,i,h,d,c,l,b,j,k,a);var g=this;this.OnEndDrag=function(){g.UpdateLocation()};this.OnScrollLeft=function(){g.UpdateLocation()};this.OnScrollRight=function(){g.UpdateLocation()};this.OnLargeScrollLeft=function(){g.UpdateLocation()};this.OnLargeScrollRight=function(){g.UpdateLocation()}}NDiagramHScrollbar.prototype=new NHScrollbar();NDiagramHScrollbar.prototype.UpdateLocation=function(){var a=this.GetRoot();a.FreezeScrolling=true;a.ExecuteServiceRequest(NDiagramRequest.GetUpdateHScrollbarPositionRequest(this.ScrollValue))};function NDiagramVScrollbar(e,f,i,h,d,c,l,b,j,k,a){this.Create(e,f,i,h,d,c,l,b,j,k,a);var g=this;this.OnEndDrag=function(){g.UpdateLocation()};this.OnScrollLeft=function(){g.UpdateLocation()};this.OnScrollRight=function(){g.UpdateLocation()};this.OnLargeScrollLeft=function(){g.UpdateLocation()};this.OnLargeScrollRight=function(){g.UpdateLocation()}}NDiagramVScrollbar.prototype=new NVScrollbar();NDiagramVScrollbar.prototype.UpdateLocation=function(){var a=this.GetRoot();a.FreezeScrolling=true;a.ExecuteServiceRequest(NDiagramRequest.GetUpdateVScrollbarPositionRequest(this.ScrollValue))};function NDiagramPanTool(){}NDiagramPanTool.prototype=new NDragTool();NDiagramPanTool.prototype.GetDeltaX=function(){};NDiagramPanTool.prototype.BeginDrag=function(a,b){if(b.Event.which!=1){return false}var c=a.GetRoot();this.HScrollbar=c.CustomData.HScrollbar;this.VScrollbar=c.CustomData.VScrollbar;if(this.HScrollbar==null&&this.VScrollbar==null){return false}a.SetCapture(true);a.ActiveTool=this;$(c.CaptureDiv).css("cursor","move");if(this.HScrollbar!=null){this.HScrollbarBeginValue=this.HScrollbar.GetValue()}if(this.VScrollbar!=null){this.VScrollbarBeginValue=this.VScrollbar.GetValue()}return true};NDiagramPanTool.prototype.DoDrag=function(a,d){var f=a.GetRoot();var b=this.MouseBegin.RelativeCoords.X-d.RelativeCoords.X;var c=this.MouseBegin.RelativeCoords.Y-d.RelativeCoords.Y;if(this.HScrollbar!=null){this.HScrollbar.SetValue(this.HScrollbarBeginValue+b)}if(this.VScrollbar!=null){this.VScrollbar.SetValue(this.VScrollbarBeginValue+c)}};NDiagramPanTool.prototype.EndDrag=function(a,b){this.CancelDrag(a,b);var c=a.GetRoot();$(c.CaptureDiv).css("cursor","default");a.SetCapture(false);if(this.HScrollbar!=null&&this.VScrollbar!=null){c.ExecuteServiceRequest(NDiagramRequest.GetUpdateScrollbarPositionsRequest(this.HScrollbar.ScrollValue,this.VScrollbar.ScrollValue))}else{if(this.HScrollbar!=null){c.ExecuteServiceRequest(NDiagramRequest.GetUpdateHScrollbarPositionRequest(this.HScrollbar.ScrollValue))}else{if(this.VScrollbar!=null){c.ExecuteServiceRequest(NDiagramRequest.GetUpdateVScrollbarPositionRequest(this.VScrollbar.ScrollValue))}}}};function NDiagramRectZoomTool(){}NDiagramRectZoomTool.prototype=new NDrawDivTool();NDiagramRectZoomTool.prototype.GetDeltaX=function(){};NDiagramRectZoomTool.prototype.BeginDrag=function(a,b){if(b.Event.which!=1){return false}this.BeginDragDiv(a,b);return true};NDiagramRectZoomTool.prototype.DoDrag=function(a,d){var i=a.GetRoot().CustomData.Window;var h=i.GetPointInRect(this.MouseEnd.RelativeCoords);var f=this.MouseBegin.RelativeCoords;var g=this.MouseEnd.RelativeCoords;var b=g.X-f.X;var c=g.Y-f.Y;if(b>0&&c>0){$(this.DragDiv).addClass("NZoomInSelection");$(this.DragDiv).removeClass("NZoomOutSelection")}else{$(this.DragDiv).addClass("NZoomOutSelection");$(this.DragDiv).removeClass("NZoomInSelection")}this.UpdateDragDiv();d.Cancel()};NDiagramRectZoomTool.prototype.EndDrag=function(a,b){this.CancelDrag(a,b);var c=a.GetRoot();var g=c.CustomData.Window;var d=g.GetPointInRect(this.MouseBegin.RelativeCoords);var f=g.GetPointInRect(this.MouseEnd.RelativeCoords);d.Offset(-g.X,-g.Y);f.Offset(-g.X,-g.Y);var h=d.X;var j=d.Y;var i=f.X;var k=f.Y;if(Math.abs(h-i)>2&&Math.abs(j-k)>2){c.ExecuteServiceRequest(NDiagramRequest.GetRectZoomRequest(h,j,i,k))}};function NDiagramCommandProcessor(){}NDiagramCommandProcessor.prototype=new NCommandProcessor();NDiagramCommandProcessor.prototype.ProcessCommand=function(e){switch(e){case"ClearCustomData":var j=this.Host.CustomData;if(j!=null){j.XScrollbarId=null;j.YScrollbarId=null;j.Window=null;j.ActiveHost=null}else{this.Host.CustomData=new Object()}return true;case"SetWindow":this.Host.CustomData.Window=this.ReadRect();return true;case"CreateImage":var F=this.ReadRect();var k=this.ReadSize();var r=this.ReadString();var q=this.ReadImageMap();var x=this.Host.Controller;var i=this.CurrentChildIndex;var h=x.TryGetChildAt(i);this.CurrentChildIndex=-1;if(h!=null){if(h.NodeType==NClientNode.ImageHost){if(h.MatchHtmlParams(F)){var g=h.TryGetChildAt(0);if(g!=null&&g.NodeType==NClientNode.Image){if(g.Size.Equals(k)){this.CurrentChildIndex=i+1;g.UpdateParams(null,r,q);this.Host.CustomData.ActiveHost=h;return true}}}}}if(i!=-1){var d=x.GetChildrenCount();x.RemoveChildrenInRange(i,d-1);this.CurrentChildIndex=-1}p=new NImageHost(this.Host.Controller,F);var o=new NInstantImage();o.Create(p,null,k,r,q);p.SetImage(o);this.Host.CustomData.ActiveHost=p;return true;case"CreateTiledImage":var F=this.ReadRect();var k=this.ReadSize();var c=this.ReadSize();var b=this.ReadSize();var y=this.ReadString();var C=this.ReadString();var t=this.ReadString();var x=this.Host.Controller;var x=this.Host.Controller;var i=this.CurrentChildIndex;var h=x.TryGetChildAt(i);this.CurrentChildIndex=-1;if(h!=null){if(h.NodeType==NClientNode.ImageHost){if(h.MatchHtmlParams(F)){var E=h.TryGetChildAt(0);if(E!=null&&E.NodeType==NClientNode.TiledImage&&E.MatchHtmlParams(k,c,b,y,null,C)){this.CurrentChildIndex=i+1;E.Invalidate();this.Host.CustomData.ActiveHost=h;return true}}}}if(i!=-1){var d=x.GetChildrenCount();x.RemoveChildrenInRange(i,d-1);this.CurrentChildIndex=-1}var p=new NImageHost(x,F);var E=new NTiledImage(k,c,b,y,null,C,t);p.SetImage(E);this.Host.CustomData.ActiveHost=p;return true;case"CreateHScrollbar":var a=this.ReadRect();var A=this.ReadSize();var z=this.ReadSize();var w=this.ReadNumber();var v=this.ReadNumber();var D=this.ReadNumber();var s=this.ReadNumber();var B=this.ReadNumber();var C=this.ReadString();var l=this.ReadString();var x=this.Host.Controller;var i=this.CurrentChildIndex;var h=x.TryGetChildAt(i);this.CurrentChildIndex=-1;var f=false;var n;if(h!=null){if(h.NodeType==NClientNode.HScrollbar){if(h.MatchHtmlParams(x,a,C,l)){this.CurrentChildIndex=i+1;h.ValueChanged=null;h.UpdateScrollbarParams(w,v,D,s,B);n=h;f=true}}}if(!f){if(i!=-1){var d=x.GetChildrenCount();x.RemoveChildrenInRange(i,d-1);this.CurrentChildIndex=-1}n=new NDiagramHScrollbar(this.Host.Controller,a,A,z,w,v,D,s,B,C,l)}var m=this.Host;n.ValueChanged=function(){m.CustomData.ActiveHost.SetOffsetX(n.ScrollValue)};this.Host.CustomData.HScrollbar=n;return true;case"CreateVScrollbar":var a=this.ReadRect();var A=this.ReadSize();var z=this.ReadSize();var w=this.ReadNumber();var v=this.ReadNumber();var D=this.ReadNumber();var s=this.ReadNumber();var B=this.ReadNumber();var C=this.ReadString();var l=this.ReadString();var x=this.Host.Controller;var i=this.CurrentChildIndex;var h=x.TryGetChildAt(i);this.CurrentChildIndex=-1;var f=false;var G;if(h!=null){if(h.NodeType==NClientNode.VScrollbar){if(h.MatchHtmlParams(x,a,C,l)){this.CurrentChildIndex=i+1;h.ValueChanged=null;h.UpdateScrollbarParams(w,v,D,s,B);G=h;f=true}}}if(!f){if(i!=-1){var d=x.GetChildrenCount();x.RemoveChildrenInRange(i,d-1);this.CurrentChildIndex=-1}G=new NDiagramVScrollbar(this.Host.Controller,a,A,z,w,v,D,s,B,C,l)}var m=this.Host;G.ValueChanged=function(){m.CustomData.ActiveHost.SetOffsetY(G.ScrollValue)};this.Host.CustomData.VScrollbar=G;return true;case"SetHostLocation":var u=this.ReadPoint();this.Host.CustomData.ActiveHost.SetLocation(u);return true;return;case"CreatePanTool":this.Host.Controller.Tools.push(new NDiagramPanTool());return true;case"CreateRectZoomTool":this.Host.Controller.Tools.push(new NDiagramRectZoomTool());return true}return this.ProcessCommonCommand(e)};function NDiagramRequest(){}NDiagramRequest.GetZoomInRequest=function(){var a=new Array();return new NRequest("ZI",new NParameterList(a))};NDiagramRequest.GetZoomOutRequest=function(){var a=new Array();return new NRequest("ZO",new NParameterList(a))};NDiagramRequest.GetUpdateHScrollbarPositionRequest=function(b){var a=new Array();a.push(new NParameter("Pos",b));return new NRequest("UHP",new NParameterList(a))};NDiagramRequest.GetUpdateVScrollbarPositionRequest=function(b){var a=new Array();a.push(new NParameter("Pos",b));return new NRequest("UVP",new NParameterList(a))};NDiagramRequest.GetUpdateScrollbarPositionsRequest=function(b,c){var a=new Array();a.push(new NParameter("X",b));a.push(new NParameter("Y",c));return new NRequest("USP",new NParameterList(a))};NDiagramRequest.GetRectZoomRequest=function(b,d,c,e){var a=new Array();a.push(new NParameter("X1",b));a.push(new NParameter("Y1",d));a.push(new NParameter("X2",c));a.push(new NParameter("Y2",e));return new NRequest("RZ",new NParameterList(a))};NDiagramRequest.GetSetLayoutRequest=function(a,c){var b=new Array();b.push(new NParameter("L",a));b.push(new NParameter("RZ",c));return new NRequest("SL",new NParameterList(b))};